<%-- 
    Document   : tungdanhmuc
    Created on : Dec 20, 2011, 11:22:29 PM
    Author     : HoangLiem
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<link href="style/body.css" rel="stylesheet" type="text/css" />
<link href="style/each_catelogy.css" rel="stylesheet" type="text/css"/>
<div id="body_left">
    <div id="acs_category" class="body_left">
        <h3>Category</h3>
        <ul>
            <li><a href="">${curDanhMuc.tenDanhMuc}</a></li>
            <li><a href="#">View All</a></li>
        </ul>
    </div>
    <div id="acs_we_recommend" class="body_left">
        <h3>We Recommend</h3>
        <ul>
            <li><a href="#">Starting at $1</a></li>
            <li><a href="#">Buy it now</a></li>
            <li><a href="#">View All</a></li>
        </ul>
    </div>
    <div id="acs_manufacturer" class="body_left">
        <h3>Manufacturer</h3>
        <ul>
            <c:forEach items="${dsDmNsx}" var="dmNsx" varStatus="dsDmNsx" begin="0" end="${dsDmNsx.size()}" step="1">
                <li><a href="tungNhaSanXuat?maDanhMuc=${curDanhMuc.maDanhMuc}&maNhaSanXuat=${dmNsx.nhasanxuat.maNhaSanXuat}">${dmNsx.nhasanxuat.tenNhaSanXuat}</a></li>
            </c:forEach>
        </ul>
    </div>
    <div id="acs_price" class="body_left">
        <h3>Price</h3>
        <ul>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${trang}&giaDau=0&giaCuoi=50000&maLoaiDauGia=${maLoaiDauGia}">0 to 500000</a></li>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${trang}&giaDau=50000&giaCuoi=200000&maLoaiDauGia=${maLoaiDauGia}">50000 to 200000</a></li>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${trang}&giaDau=200000&giaCuoi=1000000000&maLoaiDauGia=${maLoaiDauGia}">Trên 200000</a></li>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${trang}&giaDau=-1&giaCuoi=-1&maLoaiDauGia=${maLoaiDauGia}">View All</a></li>
        </ul>
    </div>
    <div class="body_left_ads">
        <a href="#"><img src="images/acs_ads.png"/></a>
    </div>
    <div class="body_left_ads">
        <a href="#"><img src="images/acs_ads.png"/></a>
    </div>
</div>
<div id="body_main">
    <div id="acs_body_main_ads">
         <a href="firstPage">Home</a> >> ${curDanhMuc.tenDanhMuc}
    </div><!--div phong hờ cho quang cao, sitemap-->
    <div id="acs_body_main_select"><!--Ba sự lựa chọn auction , buy it, all listing-->
        <ul>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=-1&maDanhMuc=${maDanhMuc}&trang=1&giaDau=${giaDau}&giaCuoi=${giaCuoi}&maLoaiDauGia=1">Auctions</a></li>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=-1&maDanhMuc=${maDanhMuc}&trang=1&giaDau=${giaDau}&giaCuoi=${giaCuoi}&maLoaiDauGia=2">Buy it Now Only</a></li>
            <li><a href="tungDanhMuc?soSanPhamTrenTrang=-1&maDanhMuc=${maDanhMuc}&trang=1&giaDau=${giaDau}&giaCuoi=${giaCuoi}&maLoaiDauGia=-1">All Listings</a></li>
        </ul>
    </div>
    <div id="acs_body_main_search"><!--khung search-->
        <span style="text-align:left;width:50%;float:left;margin-top:10px;">${dsSanPham.size()} result at page ${trang}</span>
        <span style="text-align:center;width:50%;float:right;margin-top:10px;">
            <form name='frmSearch' action='danhSach?loaids=s' method='get'>
                <input type="text" size="25" name="tbSearch" id="tbSearch"/>
                <a href="danhSach?loaids=s&tbSearch=${requestScope.tbSearch}"><img width="25" height="25" src="images/search.png" /></a>
            </form>
        </span>
    </div>
    <div id="acs_body_main_page"><!--div để ghi chỉ số trang và chọn hiển thị mấy items-->
        <span style="text-align:left;width:50%;float:left;margin-top:10px;">Trang 
            <c:forEach var="p" begin="1" end="${soTrang}" step="1">
                <c:choose>
                    <c:when test="${p} == ${trang}">
                        <a href='tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${p}&giaDau=${giaDau}&giaCuoi=${giaCuoi}&maLoaiDauGia=${maLoaiDauGia}'><b>${p}</b></a>                         
                    </c:when>
                    <c:otherwise>
                        <a href='tungDanhMuc?soSanPhamTrenTrang=${soSpTrenTrang}&maDanhMuc=${maDanhMuc}&trang=${p}&giaDau=${giaDau}&giaCuoi=${giaCuoi}&maLoaiDauGia=${maLoaiDauGia}'>${p}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
        </span>
        <span style="text-align:center;width:50%;float:right;margin-top:10px;">
            <form name='frmItemsPerPage' action='tungDanhMuc' method='get'>
                <label for='Items'>Items per page :</label>
                <select name='soSanPhamTrenTrang' onchange='submit()'>
                    <c:forEach var="k" begin="1" end="5" step="1">
                        <option 
                            <c:if test="${pageScope.k * 5 == soSpTrenTrang}">
                                selected ='selected' 
                            </c:if>
                            value='${pageScope.k * 5}'>${pageScope.k * 5}</option> 
                    </c:forEach>
                    <option 
                        <c:if test="${soSpTrenTrang == -1}"> 
                            selected ='selected' 
                        </c:if>
                        value='-1'>Tất cả</option>

                </select>
                <input type='hidden' name='maDanhMuc' value='${maDanhMuc}'/>
                <input type='hidden' name='maLoaiDauGia' value='${maLoaiDauGia}'/>
                <input type='hidden' name='trang' value='${trang}'/>
                <input type='hidden' name='giaDau' value='${giaDau}'/>
                <input type='hidden' name='giaCuoi' value='${giaCuoi}'/>
            </form>
        </span>
    </div>
    <div id="acs_body_main_list">
        <div>
            <c:choose>
                <c:when test="${dsSanPham.size()==0}">
                    Không có item nào
                </c:when>
                <c:otherwise>
                    Danh sách item
                </c:otherwise>
            </c:choose>
        </div>
        <c:set var="i" value="-1"/>
        <c:forEach items="${dsSanPham}" var="sanPham" varStatus="dsSanPham" begin="0" end="${dsSanPham.size()}" step="1">
            <c:set var="i" value="${i+1}"/>
            <div class="item">
                <c:if test="${sanPham.getHinhanhs().size()>0}">
                    <c:set var="dsHinhAnh" value="${DaydsHinhAnh[i]}"/>
                    <div style="width:100%; height:50%;">
                        <a href="chiTietSanPham?id=${sanPham.maSanPham}"><img src="images/productImages/${dsHinhAnh[0].tenHinhAnh}"/></a>
                    </div>
                </c:if>
                <div style="width:100%; height:25%;">
                    <a href="chiTietSanPham?id=${sanPham.maSanPham}" style="padding:10px;">${sanPham.tenSanPham}</a>
                </div>
                <div style="width:100%; height:25%; text-align:left;">
                    <c:if test="${user.dienThoai == 'a'}">
                        <a style="text-decoration: none;" href="capNhatSanPham?masp=${sanPham.maSanPham}">edit </a>
                        <a style="text-decoration: none;" href="xoaSanPham?masp=${sanPham.maSanPham}">delete</a>
                        <h5>ProductId  : ${sanPham.maSanPham} </h5>
                    </c:if>
                    <h3>Bid to Beat: ${sanPham.giaKhoiDiem*1000}</h3>
                    <h5>Closing: ${sanPham.getThoiDiemKetThuc()}</h5>
                </div>
            </div>
        </c:forEach>
    </div>
    <!--end list production-->
    <div id="ads" style="width:100%;height:20px;background-color:white;margin-top:30px;clear:both;">
    </div>
    <div id="ads" style="width:100%;height:20px;background-color:violet;clear:both;">
        <a href="#"><img src="#"/>Nơi để quảng cáo</a>
    </div>
</div>
